import { get, postForm, postBlob, post, service } from '@/api/common-api';

// 阜康换流站数据接口
export const getDeviceList = () => get("/zdyj/run/fk/overview", {
    params: {
        locationName: '阜康换流站'
    }
});
// 子模块实时数据
export const getModel = (bridgeName, electrodeName, locationName) => get(`/zdyj/run/fk/bridge`, {
    params: {
        bridgeName,
        electrodeName,
        locationName
    }
});

/**
 * 子模块测点实时数据 - 子模块的点位评估结果信息 API
 * @param {*} controlName 正极或负极
 * @param {*} bridgeName 桥臂名字
 * @param {*} submoduleName 子模块名字
 * @returns 子模块的点位评估结果信息
 */
export const getMeasure = (bridgeName, electrodeName, locationName, moduleName) => get(`/zdyj/run/fk/module`, {
    params: {
        bridgeName,
        electrodeName,
        locationName,
        moduleName
    }
});

// 内水冷波形 - 阜康
export const getXJHistoryWaterWaveform = (params) => get("/zdyj/run/fk/trend", { params });
// 内水冷波形 - 中都
export const getZdyjRunZdTrend = (params) => get("/zdyj/run/zd/trend", { params });

// 报告文件分页
export const getXJReportFilePageList = (params) => post("/zdyj/generateReport/page", params);
// 获取文件
export const getSysFileQueryFileById = (params) => get("/zdyj/generateReport/down", { params });
// 数据统计
export const getXJHistoryDistribute = (params) => get("/zdyj/overview/get", { params });

// 换流站列表
export const getXjSiteList = (params) => get("/xj-site/list", { params });

// 桥臂详情
export const getModelZhongdu = (bridgeName, electrodeName, locationName) => get(`/zdyj/run/zd/bridge`, {
    params: {
        bridgeName,
        electrodeName,
        locationName
    }
});
/**
 * 子模块测点实时数据 - 子模块的点位评估结果信息 API - 中都
 * @param {*} controlName 正极或负极
 * @param {*} bridgeName 桥臂名字
 * @param {*} submoduleName 子模块名字
 * @returns 子模块的点位评估结果信息
 */
export const getMeasureZhongdu = (
    bridgeName,
    electrodeName,
    locationName,
    moduleName
) => get(`/zdyj/run/zd/module`, {
    params: {
        bridgeName,
        electrodeName,
        locationName,
        moduleName
    }
});
// 水冷告警历史
export const getXJHistoryWaterHistoryAlarm = (params) => post(`/zdyj/alarmHistory/sl/alarmPage`, params);



// 换流阀列表
export const getXjValueList = (params) => get("/xj-valve/list", { params });
// 桥臂列表
export const getXjArmList = (params) => get("/xj-arm/list", { params });
// 子模块列表
export const getXjModelList = (params) => get("/xj-model/list", { params });
// 测点列表
export const getXjMeasureList = (params) => get("/xj-measure/list", { params });

// 均值对比
export const getHistoryMeanValue = (params) => post("/xj-history/meanValue", params);
// 家族对比
export const getHistoryFamily = (params) => post("/xj-history/family", params);
// 分布明细
export const getHistoryDistribute = (params) => post("/xj-history/distribute", params);


// 黑模块清零
export const getBlackReset = (params) => get("/earlyWarn/blackReset", { params });

// 设备台账
// export const getDeviceList = (params) => get("/xj-valve/list", { params });



// 设备台账
export const getDeviceDetail = (params) => get("/xj-valve/detail", { params });

// 桥臂实时数据
export const getArm = (params) => get("/earlyWarn/arm", { params });

// 子模块实时数据
// export const getModel = (params) => get("/earlyWarn/model", { params });

// 异常状态告警列表
export const getWarnList = (params) => get("/earlyWarn/warnList", { params });

// 换流站概况
export const siteSurvey = (params) => get("/earlyWarn/siteSurvey", { params });





// 子模块测点波形
export const getXJHistoryPointWaveform = (params) => post("/xj-history/pointWaveform", params);

// 子模块测点告警分析
export const getXJHistoryAlarmAnalyse = (params) => get("/earlyWarn/alarmAnalyse", { params });



// 报告导出
export const getEarlyWarnReportExport = (params) => post("/earlyWarn/reportExport", params);




























































// 故障案例库
// 列表
export const exportFaultAnalysis = params => postBlob('/converter-api/faultAnalysis/exportFaultAnalysis', params);
// 列表
export const getLocalHistoryCase = params => post('/hytpapi/local_history_case', params);
export const getLocalTraceability = params => post('/hytpapi/local_traceability', params);
// 列表
export const getDefectListByCodes = params => get('/converter-api/defectLib/getDefectListByCodes', { params });
// 列表
export const getDefectSelect = params => get('/converter-api/defectLib/getDefectSelect', { params });
// 列表
export const getDefectList = params => get('/converter-api/defectLib/getDefectList', { params });
// 删除
export const batchDelDefect = params => postForm('/converter-api/defectLib/batchDelDefect', params);
// 新增
export const addDefect = params => post('/converter-api/defectLib/addDefect', params);
// 编辑
export const editDefect = params => post('/converter-api/defectLib/editDefect', params);
// 详情
export const getDefectDetail = params => get('/converter-api/defectLib/getDefectDetail', { params });
// 附件
export const uploadDefectFile = params => postForm('/converter-api/defectLib/uploadDefectFile', params);
// 设备型号
export const getDefectModelList = params => get('/converter-api/defectLib/getDefectModelList', { params });
// 设备类型
export const getDefectDeviceTypeList = params => get('/converter-api/defectLib/getDefectDeviceTypeList', { params });
//厂家
export const getDefectFactoryList = params => get('/converter-api/defectLib/getDefectFactoryList', { params });
//故障类型
export const getDefectFaultTypeList = params => get('/converter-api/defectLib/getDefectFaultTypeList', { params });
//定位部件
export const getDefectFaultPartList = params => get('/converter-api/defectLib/getDefectFaultPartList', { params });

//故障案例库导出
// export const exportDefectFile = params => get('/converter-api/defectLib/exportDefectFile', { params });
//
// export function  function download(url, params) {
//     return request({
//         url: url + '?' + qs.stringify(params, { indices: false }),//拼接URL地址
//         method: 'get',
//         responseType: 'blob'//blob类型
//     })
// }

// excel 导出
export const exportExcel = (url, params) => service({
    method: 'get',
    url: url,
    params,
    responseType: 'blob'
});
//故障案例库详情导入
export const importDefectFile = params => post('/converter-api/defectLib/importDefectFile', params);


//识别图片
export const uploadFile = params => post('/uploadFile', params);

